from django.db import models
from lapi_app.models.management_model.point_name import Point_name
from lapi_app.models.management_model.point_pid import Point_pid
from lapi_app.models.user_model.user_info import Userinfo
#
#
# class Point_config(models.Model):
#     field_name = models.CharField("属性名", max_length=255, null=False)
#     field_value = models.CharField("目标值", max_length=255, null=False)
#     field_status = models.IntegerField("是否可为空", default=1, null=False)  # 0：可为空，1：必传
#     create_time = models.DateTimeField("创建时间", auto_now_add=True)
#     update_time = models.DateTimeField("更新时间", auto_now_add=True)
#     user = models.ForeignKey(Userinfo, on_delete=models.CASCADE)
#     p = models.ForeignKey(Point_name, on_delete=models.CASCADE)
#
#     def __str__(self):
#         return self.field_name


class Point_check_result(models.Model):
    result_true = models.TextField("校验通过", null=True)
    result_fail = models.TextField("校验失败", null=True)
    create_time = models.DateTimeField("创建时间", auto_now_add=True)
    update_time = models.DateTimeField("更新时间", auto_now_add=True)
    user = models.ForeignKey(Userinfo, on_delete=models.CASCADE)
    point_name = models.ForeignKey(Point_name, on_delete=models.CASCADE)
    point_pid = models.ForeignKey(Point_pid, on_delete=models.CASCADE)

    def __str__(self):
        return self.result_true
